/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package formulagraph;

import formulagraph.lineas.Linea;

/**
 *
 * @author soler4888
 */
public class Ejes {

    private double xini;
    private double yini;
    private double xfin;
    private double yfin;
    private Linea lineaX;
    private Linea lineaY;
    
    public Ejes(double xini, double yini, double xfin, double yfin, Linea lineaX, Linea lineaY) {
        this.xini = xini;
        this.yini = yini;
        this.xfin = xfin;
        this.yfin = yfin;
        this.lineaX = lineaX;
        this.lineaY = lineaY;
    }

    public Linea getLineaX() {
        return lineaX;
    }

    public Linea getLineaY() {
        return lineaY;
    }
    
    public String dibujar() {
        StringBuilder builder = new StringBuilder();
        
        // Eje X
        builder.append("<line ");
        builder.append("x1=\"").append(xini).append("\"");
        builder.append("y1=\"").append(0).append("\"");
        builder.append("x2=\"").append(xfin).append("\"");
        builder.append("y2=\"").append(0).append("\"");
        builder.append(lineaX.dibujar());
        builder.append("/>\n");
        
        // Eje Y
        builder.append("<line ");
        builder.append("x1=\"").append(0).append("\"");
        builder.append("y1=\"").append(-yini).append("\"");
        builder.append("x2=\"").append(0).append("\"");
        builder.append("y2=\"").append(-yfin).append("\"");
        builder.append(lineaY.dibujar());
        builder.append("/>");
        
        return builder.toString();
    }
}
